<?php
/*
*  -------------------------------------------------
/**
*作用: 优惠券
*说明:  coupon.php
*版权: v1.0
*作者:Red	QQ:513072539
*时间:2011/7/28
*-------------------------------------------------
*/
//not allow autorun
include_once './include/init.inc.php';

include_once './include/cpc_qplus.cls.php';
include_once './include/model.cls.php';
$model = new model_sql();
if(empty($s)){
	$s = 'coupon';
}
//$user_id=getCookie('user_id');
$id=empty($id) ? '' : intval($id);  //传分类ID

//最新优惠卷
$sql="SELECT * FROM `info_q_coupon` WHERE `enable`='1' ORDER BY `dateline` DESC  LIMIT 4";
$new=$db->fetch_all($sql);
if($new)
{
	//遍历图片
	foreach ($new as $key => $val )
	{

	   if($val['photo'])
	   {
			$new[$key]['link_images']='http://q.chinapet.com/upload/coupon/'.$val['photo'];
	   }

	}
}
$smarty->assign('sort_id',$id);
$smarty->assign('new',$new);

$smarty->assign('coupon_list', $a=getSpecialGoods('info_q_coupon','coupon',"`sort_id`='{$id}'",9));
//传优惠卷分类
$smarty->assign('sort_list',$a=$db->fetch_all("SELECT * FROM `info_q_usual_sort` WHERE `type`='2' AND `is_enable`='1' LIMIT 5"));
fheader('coupon/'.$s.'_style.css');
$smarty->display('coupon/'.$s.'.dwt');   //coupon.dwt

ffooter();


?>